﻿using System;
using System.Collections.Generic;
using System.Web;

using SimpleText.Framework;
using System.Xml;
using System.Web.Caching;
using System.Configuration;

public class BasePage : System.Web.UI.Page
{
	public TextEngine Txt = null;

	public void InitPage()
	{
		Txt = new TextEngine(GetLanguageVersioningModelXmlDoc());
		Txt.SetLanguageByShortname(ConfigurationManager.AppSettings["LanguageName"]);
	}
	public XmlDocument GetLanguageVersioningModelXmlDoc()
	{
		string cacheKey = "LanguageVersioningXmlDoc";
		XmlDocument doc = (XmlDocument)Cache[cacheKey];

		if (doc == null)
		{
			doc = new XmlDocument();
			doc.Load(Server.MapPath("~/App_Data/sample.xml"));
			Cache.Insert(cacheKey, doc, null, DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration);
		}
		return doc;
	}
}
